package Formularios;

import java.awt.*;
import javax.swing.*;

/**
 *
 * @author Cleiviane
 */
public class TelaInicio extends javax.swing.JFrame {

    private static boolean logado = true;

    /**
     * @return the logado
     */
    public static boolean isLogado() {
        return logado;
    }

    /**
     * @param aLogado the logado to set
     */
    public static void setLogado(boolean aLogado) {
        logado = aLogado;
    }


    /** Creates new form TelaInicio */
    public TelaInicio() {
        initComponents();
        this.setExtendedState(MAXIMIZED_BOTH);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktop = new javax.swing.JDesktopPane();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPane1 = new javax.swing.JTextPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        MenuCadastros = new javax.swing.JMenu();
        MenuPacientes = new javax.swing.JMenuItem();
        MenuMedicos = new javax.swing.JMenuItem();
        MenuMedicamentos = new javax.swing.JMenuItem();
        MenuFuncionarios = new javax.swing.JMenuItem();
        MenuParceiros = new javax.swing.JMenuItem();
        MenuUsuarios = new javax.swing.JMenuItem();
        MenuConsulta = new javax.swing.JMenu();
        MenuConsultas = new javax.swing.JMenuItem();
        MenuAgendamentos = new javax.swing.JMenuItem();
        MenuRelatorios = new javax.swing.JMenu();
        Relatorios = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        desktop.setBackground(new java.awt.Color(0, 153, 153));

        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setFont(new java.awt.Font("Ravie", 1, 36));
        jLabel4.setForeground(new java.awt.Color(0, 51, 255));
        jLabel4.setText("    Sistema de Apoio a Cliníca Médica");
        jLabel4.setBounds(30, 30, 1130, 110);
        desktop.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jScrollPane1.setViewportView(jTextPane1);

        jScrollPane1.setBounds(-10, 0, 1340, 150);
        desktop.add(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/LogoSistema1.jpg"))); // NOI18N
        jLabel1.setBounds(310, 160, 400, 410);
        desktop.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setFont(new java.awt.Font("Ravie", 1, 48));
        jLabel2.setText("Sisam");
        jLabel2.setBounds(480, 570, 280, 80);
        desktop.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        MenuCadastros.setText("Cadastros");

        MenuPacientes.setFont(new java.awt.Font("Segoe UI", 1, 14));
        MenuPacientes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone_pacientes.jpg"))); // NOI18N
        MenuPacientes.setText("Pacientes");
        MenuPacientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuPacientesActionPerformed(evt);
            }
        });
        MenuCadastros.add(MenuPacientes);

        MenuMedicos.setFont(new java.awt.Font("Segoe UI", 1, 14));
        MenuMedicos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone_medicos.jpg"))); // NOI18N
        MenuMedicos.setText("Médicos");
        MenuMedicos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuMedicosActionPerformed(evt);
            }
        });
        MenuCadastros.add(MenuMedicos);

        MenuMedicamentos.setFont(new java.awt.Font("Segoe UI", 1, 14));
        MenuMedicamentos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icon_remedio.jpg"))); // NOI18N
        MenuMedicamentos.setText("Medicamentos");
        MenuMedicamentos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuMedicamentosActionPerformed(evt);
            }
        });
        MenuCadastros.add(MenuMedicamentos);

        MenuFuncionarios.setFont(new java.awt.Font("Segoe UI", 1, 14));
        MenuFuncionarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone-funcionarios.jpg"))); // NOI18N
        MenuFuncionarios.setText("Funcionários");
        MenuFuncionarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuFuncionariosActionPerformed(evt);
            }
        });
        MenuCadastros.add(MenuFuncionarios);

        MenuParceiros.setFont(new java.awt.Font("Segoe UI", 1, 14));
        MenuParceiros.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone_parceiro.jpg"))); // NOI18N
        MenuParceiros.setText("Parceiros");
        MenuParceiros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuParceirosActionPerformed(evt);
            }
        });
        MenuCadastros.add(MenuParceiros);

        MenuUsuarios.setFont(new java.awt.Font("Segoe UI", 1, 14));
        MenuUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone_usuarios.gif"))); // NOI18N
        MenuUsuarios.setText("Usuários");
        MenuUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuUsuariosActionPerformed(evt);
            }
        });
        MenuCadastros.add(MenuUsuarios);

        jMenuBar1.add(MenuCadastros);

        MenuConsulta.setText("Consultas");

        MenuConsultas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone-consultas.png"))); // NOI18N
        MenuConsultas.setText("Consultas");
        MenuConsultas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuConsultasActionPerformed(evt);
            }
        });
        MenuConsulta.add(MenuConsultas);

        MenuAgendamentos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/icone_agendamento.jpg"))); // NOI18N
        MenuAgendamentos.setText("Agendamentos");
        MenuAgendamentos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuAgendamentosActionPerformed(evt);
            }
        });
        MenuConsulta.add(MenuAgendamentos);

        jMenuBar1.add(MenuConsulta);

        MenuRelatorios.setText("Relatórios");
        MenuRelatorios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuRelatoriosActionPerformed(evt);
            }
        });

        Relatorios.setText("Relatórios");
        Relatorios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RelatoriosActionPerformed(evt);
            }
        });
        MenuRelatorios.add(Relatorios);

        jMenuBar1.add(MenuRelatorios);

        jMenu1.setText("Sobre");

        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Formularios/Imagens/sobre.gif"))); // NOI18N
        jMenuItem1.setText("Sobre");
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Sair");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 1160, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 668, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void MenuPacientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuPacientesActionPerformed
            if (isLogado()) {
                Cadastro_Paciente telaPac = new Cadastro_Paciente();
                desktop.add(telaPac);
                centralizaTela(telaPac);
                telaPac.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
	}//GEN-LAST:event_MenuPacientesActionPerformed

	private void MenuFuncionariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuFuncionariosActionPerformed
            if (isLogado()) {
                Cadastro_Funcionarios telaFunc = new Cadastro_Funcionarios();
                desktop.add(telaFunc);
                centralizaTela(telaFunc);
                telaFunc.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
	}//GEN-LAST:event_MenuFuncionariosActionPerformed

        private void MenuMedicosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuMedicosActionPerformed
            if (isLogado()) {
                Cadastro_Medicos telaMed = new Cadastro_Medicos();
                desktop.add(telaMed);
                centralizaTela(telaMed);
                telaMed.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
}//GEN-LAST:event_MenuMedicosActionPerformed

        private void MenuMedicamentosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuMedicamentosActionPerformed
            if (isLogado()) {
                Cadastro_Medicamentos telaMedic = new Cadastro_Medicamentos();
                desktop.add(telaMedic);
                centralizaTela(telaMedic);
                telaMedic.setVisible(true);
            } else {
               JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
        }//GEN-LAST:event_MenuMedicamentosActionPerformed

        private void MenuParceirosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuParceirosActionPerformed
             if (isLogado()) {
                Cadastro_Parceiros telaParc = new Cadastro_Parceiros();
                desktop.add(telaParc);
                centralizaTela(telaParc);
                telaParc.setVisible(true);
            } else {
               JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
        }//GEN-LAST:event_MenuParceirosActionPerformed

        private void MenuUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuUsuariosActionPerformed
             if (isLogado()) {
                Cadastro_Usuario telaUsuario = new Cadastro_Usuario();
                desktop.add(telaUsuario);
                centralizaTela(telaUsuario);
                telaUsuario.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
        }//GEN-LAST:event_MenuUsuariosActionPerformed

        private void MenuConsultasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuConsultasActionPerformed
            if (isLogado()) {
                Consulta_Medica telaConsulta = new Consulta_Medica();
                desktop.add(telaConsulta);
                centralizaTela(telaConsulta);
                telaConsulta.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
        }//GEN-LAST:event_MenuConsultasActionPerformed

        private void MenuAgendamentosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuAgendamentosActionPerformed
            if (isLogado()) {
                Cadastro_Agendamento telaAgend = new Cadastro_Agendamento();
                desktop.add(telaAgend);
                centralizaTela(telaAgend);
                telaAgend.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
        }//GEN-LAST:event_MenuAgendamentosActionPerformed

        private void MenuRelatoriosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuRelatoriosActionPerformed

        }//GEN-LAST:event_MenuRelatoriosActionPerformed

        private void RelatoriosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RelatoriosActionPerformed
              if (isLogado()) {
                Relatorios telaRelat = new Relatorios();
                desktop.add(telaRelat);
                centralizaTela(telaRelat);
                telaRelat.setVisible(true);
            } else {
                JOptionPane.showMessageDialog(this, "Você ainda não está logado!");
            }
        }//GEN-LAST:event_RelatoriosActionPerformed

    public static void centralizaTela(JInternalFrame fr) {
        Dimension d = fr.getDesktopPane().getSize();
        fr.setLocation((d.width - fr.getSize().width) / 2, (d.height - fr.getSize().height) / 2);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {

                new TelaInicio().setVisible(true);
            }
        });

    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem MenuAgendamentos;
    private javax.swing.JMenu MenuCadastros;
    private javax.swing.JMenu MenuConsulta;
    private javax.swing.JMenuItem MenuConsultas;
    private javax.swing.JMenuItem MenuFuncionarios;
    private javax.swing.JMenuItem MenuMedicamentos;
    private javax.swing.JMenuItem MenuMedicos;
    private javax.swing.JMenuItem MenuPacientes;
    private javax.swing.JMenuItem MenuParceiros;
    private javax.swing.JMenu MenuRelatorios;
    private javax.swing.JMenuItem MenuUsuarios;
    private javax.swing.JMenuItem Relatorios;
    private javax.swing.JDesktopPane desktop;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextPane jTextPane1;
    // End of variables declaration//GEN-END:variables
}
